{==================================================]
           OSi: Odie's Scripting Include
                      v3.32
            By pplsuqbawlz and Odie5533
             http://www.OGLabs.cjb.net
[==================================================]
 Thanks to: RSCN, x piv x, GenoDemoN, Joolz, Chriz,
            Gussy, Khain, OhDearUrDead, Stupid,
            Wallbot, and anyone I forgot to mention!
[==================================================}

{Please note: Please do not edit this script, instead
              please PM me on RSCN or post what you
              want updated in the forums, and I will
              most likely be glad to update for you
 Also note: You are NOT allowed to take any piece(s)
            from/out of OSi, all parts must be left in
            and the only way to use it's procedures is
            to include OSi in your script(s)}

{ChangeLog:
 v1.0 - Initial release
 v2.0 - Added UberWait and Autologin, updated a few things
 v2.1 - Added LoadBankBmps; feature
 v2.5 - Added AutoDrop; feature
 v2.51 - Added StartScriptSlow; Feature
 v3.0 - Added full banking and UseItem procedures
 v3.1 - Updated... some things... I think
 v3.2 - Updated the UseItem feaature
 v3.3 - Updated loads and added loads. Also, welcome pplsuqbawlz to the
        OSi scripting team!
 v3.31 - Updated mouse procedures
 v3.32 - Added LogedIn and NotLogedIn
 v3.4 - Added many procedures and updated things}

var x,y,StoreAll,StoreAllY,rcmQuickBank,rcmQuickBankY,WithdrawAll,
    Banks,flag,s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,DropYe,DropW:integer;
Loged,Screenshot,LoadedStatBmps,LoadedBankBmps,LoadedDropBmps:boolean;
ST:LongInt;
screendir:string;

Procedure SetupOSiOSi;
begin
//=====================Setup=======================
Screenshot:=true; //If you want to take screenshots, true, else, false
Screendir:=''; //Set the directory to save screenshots
//=================================================
end;

Procedure MMouse(x,y,rx,ry: Integer); {Made by Odie5533}
begin
 x:=x+random(rx); y:=y+random(ry);
if(x<=789)and(x>=0)and(y<= 592)and(y>=0)then
begin
 Wait(100+random(50));
 MoveMouseSmoothEx(x,y,1,6,15,20,10);
 GetMousePos(x,y);
 Wait(300+random(100));
end;
end;

Procedure Mouse(x,y,rx,ry: integer; left:boolean);{Made By GenoDemoN, Modified by Odie5533}
begin
x:=x+random(rx); y:=y+random(ry);
if(x<=789)and(x>=0)and(y<= 592)and(y>=0)then
begin
movemousesmoothex(x,y,1,6,15,20,10);
GetMousePos(x,y);
Wait(50+random(50));
HoldMouse(x,y,left);
Wait(10+random(70));
ReleaseMouse(x,y,left);
wait(300+random(100));
end;
end;

procedure UberWait(wai:integer); {Created by GenoDemoN}
 var waii:longint;
 begin
 waii:=wai+random(wai/2)+getsystemtime;
 repeat
 wait(random(10));
 until(getsystemtime>waii);
 end;
 
Procedure Display(otext:string); {Created by Odie5533}
begin
status(otext);
writeln(otext);
end;

procedure RWait (ranlength: string);
begin
   if(ranlength = 'xxshort') then wait(15+random(15)+random(15))
   if(ranlength = 'xshort')  then wait(50+random(25)+random(25))
   if(ranlength = 'short')   then wait(100+random(50)+random(50))
   if(ranlength = 'medium')  then wait(200+random(100)+random(100))
   if(ranlength = 'long')    then wait(500+random(250)+random(250))
   if(ranlength = 'xlong')   then wait(1000+random(500)+random(500))
   if(ranlength = 'xxlong')  then wait(1000+random(500)+random(500)+random(500)+random(500))
end;

procedure GetScreenShot(reason:string; event:Integer);
var x:string;
begin
if(screenshot)then
  begin
  x:=inttostr(Event)
  SaveScreenshot('C:\Documents and Settings\Alexander\My Documents\My Pictures'+'Scripts\'+Screendir+'\'+reason+inttostr(strtoint((copy(x,length(x),1))))+'.bmp');
  writeln('ScreenCaptureFor'+reason+inttostr(strtoint((copy(x,length(x),1))))+'.bmp');
  end;
end;

Function LogedIn:boolean;
begin
if(GetColor(377,472)=2370094)then
 result:=true;
end;

Function NotLogedIn:boolean;
begin
if(GetColor(377,472)=8291967)then
 result:=true;
end;

Procedure Face(facing:string);
var direction:integer;
begin
if(facing='N')then
  direction := BitmapFromString(8, 11,
       '640000640000640000000001640000790E00640000640000640000' +
       '790E00640000640000790E003F00003F0000790E00790E003F0000' +
       '3F0000790E00851B003F00003F0000851B00851B003F00003F0000' +
       '3F0000790E003F00003F00009622009622003F00003F00003F0000' +
       '790E003F00003F00009622009622003F00003F0000790E003F0000' +
       '3F00003F00009622009622003F00003F00009622003F00003F0000' +
       '3F00009622009622003F00003F00009622009622003F00003F0000' +
       '9C36009C36003F00003F0000AB4601AB46013F00003F00009C3600' +
       'AB46013F00003F00009C3600AB4601AB4601AB4601AB4601AB4601' +
       'AB4601AB46010000019C3600BA5604BA5604BA5604');
if(facing='W')then
  direction := BitmapFromString(9, 10,
       '640000640000640000640000000001640000790E00640000640000' +
       '640000640000851B006400000000011B00001B00001B00001B0000' +
       '851B00851B00851B00790E006400001B00001B0000851B00851B00' +
       '851B00790E001B00001B00001B0000851B00851B00962200962200' +
       '1B00001B00001B00001B0000790E001B00001B0000851B00851B00' +
       '851B00851B001B00001B00001B00001B00001B00001B00001B0000' +
       '9C36009C3600851B00851B00851B001B00001B0000851B009C3600' +
       '9C3600851B001B00001B00001B0000851B009C3600AB4601AB4601' +
       '3F00001B00001B00001B0000851B001B00001B00009C3600AB4601' +
       '9C36009C36001B00001B00001B00001B00001B00001B00003F0000' +
       '');
if(facing='S')then
  direction := BitmapFromString(6, 10,
       '20201E20201E640000000001640000851B00640000790E00640000' +
       '0000011B0000790E00790E001B00001B00000000011B00001B0000' +
       '1B00001B0000790E00790E00851B00851B001B00001B0000851B00' +
       '851B00851B00851B001B00001B00001B00001B00001B00001B0000' +
       '9C3600851B001B00001B00001B00001B00009C36009C36009C3600' +
       '851B001B00001B00003F00001B00009C3600851B001B00009C3600' +
       '9C36001B00001B00001B00009C3600AB4601');
if(facing='E')then
  direction := BitmapFromString(8, 6,
       '851B00851B00851B001B0000851B00962200851B001B00001B0000' +
       '851B00851B001B0000851B00962200851B001B00001B0000851B00' +
       '851B001B0000851B00851B00851B001B00001B0000851B00851B00' +
       '1B00001B00001B00001B00001B00001B00001B00001B00001B0000' +
       '1B00001B00001B00001B00001B00001B00001B00009C36009C3600' +
       '9C36009C36009C3600');
if(length(facing)>0)then
while(not(FindBitmapIn(direction,x,y,561,4,571,17)))do
 SendArrowSilentWait(1,2);
end;

Procedure SetRun(runon: boolean); {Edited by Odie5533}
begin
   Wait(20+random(5));
   Mouse(701,468,10,25,true);
   Wait(70+random(50));
   if(not(GetColor(607,263)=2303648))and(RunOn)then
   Mouse(611,253,15,15,true);
   if(GetColor(607,263)=2303648)and(not RunOn)then
   Mouse(569,256,5,5,true);
   Wait(100+random(50));
   Mouse(644,178,5,5,true);
   Wait(100+random(50));
End;

Procedure OpenBag; {Created by Odie5533}
begin
if(not (GetColor(633,179)=2829182))then
begin
 wait(400+random(100));
 Mouse(635,176,15,15,true);
 wait(400+random(100));
end;
end;

procedure SetFightMode(oFightMode:integer);
begin
wait(200+random(50));
if(GetColor(559,179)=5531511)then
Mouse(548,176,10,15,true);
wait(200+random(50));
if(oFightMode=1)and(not (GetColor(565,282)=2303647))then
Mouse(569,271,55,15,true);
if(oFightMode=2)and(not (GetColor(565,323)=2303647))then
Mouse(569,311,55,15,true);
if(oFightMode=3)and(not (GetColor(565,367)=2303647))then
Mouse(569,352,55,15,true);
if(oFightMode=4)and(not (GetColor(565,411)=2303647))then
Mouse(571,403,55,15,true);
wait(100+random(50));
OpenBag;
end;

Procedure ChatFixer; {ChatFixer by Odie5533}
begin
 while(not(GetColor(54,496)=255))and(LogedIn)do
  Mouse(45,485,15,10,true);
 wait(300+random(100));
 while(not(GetColor(183,496)=255))and(LogedIn)do
  Mouse(176,485,15,10,true);
 wait(300+random(100));
 while(not(GetColor(323,496)=255))and(LogedIn)do
  Mouse(315,485,15,10,true);
 wait(300+random(100));
end;

procedure sendkeyssilentsmooth(text:string;pause:integer); {Created by Piv}
begin
repeat
sendkeyssilent(copy(text,1,1)); wait(pause+random(50));
delete(text,1,1); wait(50);
until(length(text)=0);
wait(100+random(50));
end;

procedure FindTextSpiral(txt: String; dx,dy: Integer; SpiralSize: Integer; step, SpiralWait: Integer);  // By OhDearUrDead, Edited By Khain
var px, py, qx, qy: Integer;
     FoundText: Boolean;
begin
   FoundText:= false;
   px:= dx; py:= dy; qx:= dx; qy:= dy;
   x:= dx;
   y:= dy;
   MoveMouseSmooth(x,y);
   repeat
   Spiralwait:= Spiralwait+random(50);
     MoveMouse(x,y)
     px:= px + 20; py:= py + 20;
     qx:= qx - 20; qy:= qy - 20;
     repeat
       getmousepos(x,y)
       x:= x + step;
       MoveMouseSmooth(x,y);
       Wait(SpiralWait);
       if(IsTextAt2(9,9,txt,100))then FoundText:= true;
     Until(x >= px)or(FoundText);
     if(FoundText)then Break;
     repeat
       getmousepos(x,y)
       y:= y + step;
       MoveMouseSmooth(x,y);
       Wait(SpiralWait);
       if(IsTextAt2(9,9,txt,100))then FoundText:= true;
     Until(y >= py)or(FoundText);
     if(FoundText)then Break;
     repeat
       getmousepos(x,y)
       x:= x - step;
       MoveMouseSmooth(x,y);
       Wait(SpiralWait);
       if(IsTextAt2(9,9,txt,100))then FoundText:= true;
     Until(qx >= x)or(FoundText);
     if(FoundText)then Break;
     repeat
       getmousepos(x,y)
       y:= y - step;
       MoveMouseSmooth(x,y);
       Wait(SpiralWait);
       if(IsTextAt2(9,9,txt,100))then FoundText:= true;
     Until(qy >= y)or(FoundText);
   Until(px > dx + SpiralSize)or(FoundText);
end;

Procedure LogOut(why:string);
var c:integer;
begin
  Writeln(' ');
  Writeln(why);
  Writeln(' ');
  Wait(100+random(10));
  Loged:=true;
  Mouse(635,470,25,20,true);
  Wait(100+random(10));
  c:=0;
  Mouse(586,370,119,10,true);
  GetMousePos(x,y);
  repeat
    c:=c+1
    Wait(250+random(100));
    ClickMouse(x,y,true);
  until(GetColor(400,130)=1842201)and(GetColor(354,120)=1842201)or(c=15);
  writeln('Infinite Loop Begin...')
  repeat
   wait(5000);
  until(false)
end;

Procedure MapFlag;
var m,mapx,mapy:integer;
begin
 Wait(300+random(100));
 while(FindBitmapIn(flag,mapx,mapy,570,5,725,162))or(M<10)do
  begin
   wait(100+random(50));
   M:=M+1;
  end;
end;

Procedure MapFlagWalk;
var M:integer;
begin
  Wait(300+random(100));
  while(FindBitmapIn(flag,x,y,570,5,725,162))and(not(FindBitmapIn(flag,x,y,633,64,665,90)))or(M<11)do
  begin
   wait(200+random(100));
   M:=M+1;
  end;
end;

Procedure LoadBankBmps;
begin
rcmQuickBank := BitmapFromString(16, 6,
       'FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000000000' +
       '000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' +
       '000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000' +
       '000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000' +
       'FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFF' +
       'FFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF' +
       '000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000' +
       '000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000' +
       'FFFFFFFFFFFF000000000000FFFFFFFFFFFF0000000000005D5447' +
       'FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFFFFFFFF' +
       '000000000000000000FFFFFFFFFFFFFFFFFF');

rcmQuickBankY := BitmapFromString(17, 5,
       'FFFF00FFFF00000000000000FFFF00FFFF00000000000000000000' +
       '000000000000000000000000FFFF00FFFF00FFFF00FFFF00FFFF00' +
       'FFFF00000000000000FFFF00FFFF00000000000000FFFF00FFFF00' +
       '000000000000FFFF00FFFF00000000000000000000FFFF00FFFF00' +
       '000000000000FFFF00FFFF00000000000000FFFF00FFFF00000000' +
       '000000FFFF00FFFF00000000000000000000FFFF00FFFF00000000' +
       '000000FFFF00FFFF00000000000000FFFF00FFFF00000000000000' +
       'FFFF00FFFF00000000000000000000FFFF00FFFF00000000000000' +
       'FFFF00FFFF00000000000000FFFF00FFFF00000000000000FFFF00' +
       'FFFF00000000000000000000');
StoreAllY := BitmapFromString(15, 6,
        'FFFF00FFFF00000000000000000000FFFF00FFFF00000000000000' +
        'FFFF00FFFF00000000000000FFFF00FFFF00FFFF00FFFF00FFFF00' +
        'FFFF00FFFF00FFFF00FFFF00000000000000FFFF00FFFF00000000' +
        '000000FFFF00FFFF00FFFF00FFFF00000000000000000000FFFF00' +
        'FFFF00000000000000FFFF00FFFF00000000000000FFFF00FFFF00' +
        'FFFF00FFFF00000000000000000000FFFF00FFFF00000000000000' +
        'FFFF00FFFF00000000000000FFFF00FFFF00FFFF00FFFF00000000' +
        '000000000000FFFF00FFFF00000000000000FFFF00FFFF00000000' +
        '000000FFFF00FFFF00FFFF00FFFF00000000000000000000FFFF00' +
        'FFFF00000000000000FFFF00FFFF00000000000000FFFF00FFFF00' +
        '');

StoreAll := BitmapFromString(15, 6,
        'FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000000000' +
        'FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' +
        'FFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFFFFFFFF000000' +
        '000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF' +
        'FFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF' +
        'FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000000000' +
        'FFFFFFFFFFFF000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000' +
        '000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000' +
        '000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF' +
        'FFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF' +
        '');
WithdrawAll := BitmapFromString(38, 2,
       'FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFFFFFFFF' +
       'FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000000000' +
       '000000FFFFFFFFFFFF000000000000000000000000000000000000' +
       'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000' +
       'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF' +
       'FFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF' +
       '000000000000000000FFFFFFFFFFFF000000000000000000000000' +
       '000000000000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF' +
       '000000000000FFFFFFFFFFFF');
LoadedBankBmps:=true;
end;

Procedure UseItem(invin:integer); {Created by Odie5533}
var rx,ry:integer;
begin
OpenBag;
if(invin>0)and(invin<29)then
begin
ry:=218;
repeat
if(invin>4)then
begin
invin:=invin-4;
ry:=ry+36;
end;
until(invin<5);
rx:=532+(invin*42);
Mouse(rx,ry,20,20,true);
wait(400+random(200));
end;
end;

function UseItemTol(invin:integer; invinname:string):boolean; {Created by Odie5533}
var rx,ry:integer;
begin
 OpenBag;
 if(invin>0)and(invin<29)then
 begin
  ry:=218;
  repeat
  if(invin>4)then
  begin
   invin:=invin-4;
   ry:=ry+36;
  end;
  until(invin<5);
  rx:=532+(invin*42);
  if(length(invinname)>0)then
  begin
   MMouse(rx,ry,15,15);
   if(IsTextAt2(9,9,invinname,100))then
   begin
    GetMousePos(x,y);
    Mouse(x,y,0,0,true);
    wait(300+random(100));
    result:=true;
   end;
  end;
 end;
end;

function UseItemColor(theitemcolor:integer):boolean; {Created by Odie5533}
var i,e:integer;
begin
 while(i<6) do
  begin
   if (i=5) and (e<8) then
    begin
     i:=0;
     e:=e+1;
    end;
   if(FindColor(x,y,theitemcolor,(569+42*i),(213+36*e),(569+42*i+31),(213+36*e+30)))then
    begin
     Mouse((580+42*i),(225+36*e),10,10,true);
     result:=true;
    end;
   i:=i+1;
   if(result)then break;
  end;
end;

Function FindObjColorTol(objname:string; objcolor,objtol:integer):boolean; {Created by pplsuqbawlz}
var a,b:integer;
begin
if(not(IsTextAt2(9,9,objname,100)))then
while(b<16)do
begin
 wait(10);
 if(a = 27)then
  begin
   a:= 0;
   b:= b + 1;
  end;
 if(b > 15)then break;
 if(FindColorSpiralTolerance(x,y,objcolor,a*20+4,b*20+4,a*20+24,b*20+24,objtol))then
  begin
   MoveMouseSmoothEx(x,y,1,6,30,20,10);
   wait(100+random(50));
   if(istextat2(9,9,objname,100))then
    begin
     result:=true;
     break;
    end;
  end;
 a:=a+1;
end;
end;

Function OpenBank:boolean; {Made by Odie5533 and pplsuqbawlz}
var c:integer;
begin
if(not LoadedBankBmps)then
 LoadBankBmps;
if(FindObjColorTol('Use Bank',2842230,11))then
  begin
   Mouse(x,y,0,0,false);
   wait(75+random(25));
   if(FindBitmap(rcmQuickBank,x,y))or(FindBitmap(rcmQuickBankY,x,y))then
    begin
     Mouse(x,y,5,2,true);
     MapFlag;
    end else
     MMouse(5,5,60,60);
    while(not(IsTextAt2(185,36,'The Bank of RuneScape',100)))and(c<30)do
    begin
     wait(50+random(25));
     c:=c+1;
    end;
  end;
 if(IsTextAt2(185,36,'The Bank of RuneScape',100))and(not(GetColor(476,76)=5531254))then
  Mouse(472,81,4,10,true); //Scrolls your bank up
 wait(200+random(100));
 if(IsTextAt2(185,36,'The Bank of RuneScape',100))then
  result:=true;
end;

Procedure Withdraw(Col,Row,Amount:integer); {Created by Odie5533}
var rx,ry,c:integer;
begin
if(not LoadedBankBmps)then
LoadBankBmps;
if(IsTextAt2(185,36,'The Bank of RuneScape', 100))and(col>0)and(row>0)and(col<5)and(row<8)then
begin
 rx:=35+(col*47)
 ry:=27+(row*38)
if(amount=1)then
begin
 Mouse(rx,ry,23,23,true);
 wait(600+random(200));
end;
if(amount=0)or(amount>1)then
begin
 Mouse(rx,ry,23,23,false)
 wait(200+random(100));
 if(amount=0)then
 begin
 if(FindBitmapIn(WithDrawAll,x,y,5,65,465,410))then
 begin
  Mouse(x,y,50,3,true)
  wait(600+random(200));
 end;
 end else
 begin
  GetMousePos(x,y)
  Mouse(x,y+81,20,10,true);
  repeat
   c:=c+1;
   wait(75);
  until(c>20)or(GetColor(258,412)=8388608)
  wait(500+random(200));
  if(GetColor(258,412)=8388608)then
   SendKeysSilentSmooth(inttostr(amount)+chr(13),100)
  wait(500+random(200));
 end;
end;
end;
end;

Procedure Deposit(Col,Row,Amount:integer); {Created by Odie5533}
var rx,ry,c:integer;
begin
if(not LoadedBankBmps)then
LoadBankBmps;
if(IsTextAt2(185,36,'The Bank of RuneScape',100))then
begin
 rx:=532+(col*42)
 ry:=178+(row*36)
if(row=0)and(amount=0)then
begin
if(col=0)then col:=1
   repeat
   begin
    if(findcolorspiral(x,y,65536,570,250,725,460))or(findcolorspiral(x,y,65536,rx,210,725,245))then
    begin
    c:=c+1
     Mouse(x,y,2,2,false);
     wait(150+random(50));
     if(FindBitmap(StoreAll,x,y))or(FindBitmap(StoreAllY,x,y))then
     begin
      Mouse(x,y,40,2,true);
      wait(600+random(200));
     end;
    MMouse(650,185,5,5);
    wait(400+random(200));
    end;
   end;
   until(not FindColorSpiral(x,y,65536,570,250,725,460))and(not findcolorspiral(x,y,65536,rx,210,725,245))or(c>28)
end;
if(col>0)and(col<5)and(row>0)and(row<8)then
begin
 wait(200+random(100));
 if(amount=1)then
 begin
  Mouse(rx,ry,20,20,true);
  wait(600+random(200));
 end else
 begin
  Mouse(rx,ry,20,20,false)
  wait(150+random(50));
  if(amount=0)then
  begin
  if(FindBitmap(StoreAll,x,y))or(FindBitmap(StoreAllY,x,y))then
  begin
   Mouse(x,y,40,2,true)
   wait(600+random(200));
  end;
  end else
  begin
   GetMousePos(x,y)
   Mouse(x,y+81,20,10,true);
   wait(900+random(300));
   SendKeysSilentSmooth(inttostr(amount)+chr(13),100)
   wait(600+random(200));
   end;
 end;
end;
end;
end;

procedure CloseBank;
begin
if(not LoadedBankBmps)then
 LoadBankBmps;
if(IsTextAt2(185,36,'The Bank of RuneScape', 100))and(GetColor(464,39)=8421504)then
 begin
  Banks:=Banks+1;
  Mouse(430,39,5,5,true);
  wait(800+random(300));
 end;
end;

function InvinCount:integer; {Created by pplsuqbawlz}
var i,e:integer;
begin
OpenBag;
 while(i<6) do
  begin
   if (i=5) and (e<8) then
    begin
     i:=0;
     e:=e+1;
    end;
   if(FindColor(x,y,65536,(569+42*i),(213+36*e),(569+42*i+31),(213+36*e+30)))then
    result:=result+1;
   i:=i+1;
  end;
end;

Procedure LoadDropBmps;
begin
LoadedDropBmps:=true;
dropW := BitmapFromString(28, 2,
       'FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000FFFFFF' +
       'FFFFFFFFFFFFFFFFFF000000000000000000FFFFFFFFFFFFFFFFFF' +
       'FFFFFF000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF' +
       '000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000' +
       'FFFFFFFFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000' +
       '000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000000000' +
       'FFFFFFFFFFFF');
dropYe := BitmapFromString(28, 2,
       'FFFF00FFFF00000000000000FFFF00FFFF00000000000000FFFF00' +
       'FFFF00FFFF00FFFF00000000000000000000FFFF00FFFF00FFFF00' +
       'FFFF00000000000000000000000000FFFF00FFFF00FFFF00FFFF00' +
       '000000FFFF00FFFF00000000000000FFFF00FFFF00000000000000' +
       'FFFF00FFFF00FFFF00000000000000000000FFFF00FFFF00000000' +
       '000000FFFF00FFFF00000000000000FFFF00FFFF00000000000000' +
       'FFFF00FFFF00');
end;

Procedure AutoDrop(item :string); {Created by Odie5533}
var Row,Col,Ix,Iy,InvLoc,Dropx,dropy:integer;
begin
if(not(LoadedDropBmps))then
 LoadDropBmps;
InvLoc:=1; Col:=1; Row:=1;
OpenBag;
repeat
  Ix:=(Col-1)*42+574;
  Iy:=(Row-1)*36+218;
  MoveMouseSmooth(Ix+random(17),Iy+random(17));
  wait(150+random(30));
  If(IsTextAt2(9,9,item,100))then
  begin
   GetMousePos(x,y);
   ClickMouse(x,y,false);
   wait(100+random(25));
   if(FindBitmap(DropW,dropx,dropy))or(FindBitmap(DropYe,dropx,dropy))then
    begin
     Mouse(dropx+10,dropy,20,4,true);
     wait(200+random(50));
    end;
  end;
  InvLoc:=InvLoc+1;
  Row:=Row+1;
  if(Row>7)then
  begin
   Col:=Col+1;
   Row:=1;
  end;
until(InvLoc>28)
end;

function DropColor(thedropcolor:integer):integer; {Created by Odie5533}
var i,e:integer;
begin
if(not(LoadedDropBmps))then
 LoadDropBmps;
 while(i<6) do
  begin
   if (i=5) and (e<8) then
    begin
     i:=0;
     e:=e+1;
    end;
   if(FindColor(x,y,thedropcolor,(569+42*i),(213+36*e),(569+42*i+31),(213+36*e+30)))then
    begin
     MoveMouseSmoothEx((580+42*i+random(10)),(225+36*e+random(10)),1,6,30,20,10);
     GetMousePos(x,y);
     ClickMouse(x,y,false);
     wait(75+random(50));
     if(FindBitmap(DropW,x,y))or(FindBitmap(DropYe,x,y))then
      begin
       Mouse(x,y,15,5,true);
       result:=result+1;
       wait(200+random(50));
      end else
       MMouse(639,179,15,15);
     end;
   i:=i+1;
  end;
end;

Procedure LoadStatBmps;
begin
s0 := BitmapFromString(5, 8,
       '000000FFFFFFFFFFFFFFFFFF000000FFFFFF000000000000000000' +
       'FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000000000' +
       '000000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000' +
       '000000000000FFFFFFFFFFFF000000000000000000FFFFFF000000' +
       'FFFFFFFFFFFFFFFFFF000000');
s1 := BitmapFromString(3, 8,
       '000000FFFFFF000000FFFFFFFFFFFF000000000000FFFFFF000000' +
       '000000FFFFFF000000000000FFFFFF000000000000FFFFFF000000' +
       '000000FFFFFF000000FFFFFFFFFFFFFFFFFF');
s2 := BitmapFromString(5, 8,
       '000000FFFFFFFFFFFFFFFFFF000000FFFFFF000000000000000000' +
       'FFFFFF000000000000000000000000FFFFFF000000000000000000' +
       'FFFFFF000000000000000000FFFFFF000000000000000000FFFFFF' +
       '000000000000000000FFFFFF000000000000000000000000FFFFFF' +
       'FFFFFFFFFFFFFFFFFFFFFFFF');
s3 := BitmapFromString(4, 8,
       '000000FFFFFFFFFFFF000000FFFFFF000000000000FFFFFF000000' +
       '000000000000FFFFFF000000FFFFFFFFFFFF000000000000000000' +
       '000000FFFFFF000000000000000000FFFFFFFFFFFF000000000000' +
       'FFFFFF000000FFFFFFFFFFFF000000');
s4 := BitmapFromString(4, 8,
       'FFFFFF000000000000000000FFFFFF000000000000000000FFFFFF' +
       '000000000000000000FFFFFF000000FFFFFF000000FFFFFF000000' +
       'FFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000FFFFFF' +
       '000000000000000000FFFFFF000000');
s5 := BitmapFromString(4, 8,
       'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF' +
       '000000000000000000FFFFFFFFFFFFFFFFFF000000000000000000' +
       '000000FFFFFF000000000000000000FFFFFFFFFFFF000000000000' +
       'FFFFFF000000FFFFFFFFFFFF000000');
s6 := BitmapFromString(5, 8,
       '000000000000FFFFFFFFFFFF000000000000FFFFFF000000000000' +
       'FFFFFFFFFFFF000000000000000000000000FFFFFF000000FFFFFF' +
       'FFFFFF000000FFFFFFFFFFFF000000000000FFFFFFFFFFFF000000' +
       '000000000000FFFFFFFFFFFF000000000000000000FFFFFF000000' +
       'FFFFFFFFFFFFFFFFFF000000');
s7 := BitmapFromString(4, 8,
       'FFFFFFFFFFFFFFFFFFFFFFFF000000000000000000FFFFFF000000' +
       '000000FFFFFF000000000000000000FFFFFF000000000000FFFFFF' +
       '000000000000000000FFFFFF000000000000FFFFFF000000000000' +
       '000000FFFFFF000000000000000000');
s8 := BitmapFromString(5, 8,
       '000000FFFFFFFFFFFFFFFFFF000000FFFFFF000000000000000000' +
       'FFFFFFFFFFFF000000000000000000FFFFFF000000FFFFFFFFFFFF' +
       'FFFFFF000000FFFFFF000000000000000000FFFFFFFFFFFF000000' +
       '000000000000FFFFFFFFFFFF000000000000000000FFFFFF000000' +
       'FFFFFFFFFFFFFFFFFF000000');
s9 := BitmapFromString(5, 8,
       '000000FFFFFFFFFFFFFFFFFF000000FFFFFF000000000000000000' +
       'FFFFFFFFFFFF000000000000000000FFFFFF000000FFFFFF000000' +
       '000000FFFFFF000000000000FFFFFFFFFFFFFFFFFF000000000000' +
       '000000000000FFFFFF000000000000000000000000FFFFFF000000' +
       '000000000000000000FFFFFF');
LoadedStatBmps:=true;
end;

Function GetStatFor(stat:string; bottom:integer):integer; {Created by Odie5533}
var ox,oy,ox2,oy2,col,row:integer;
begin
if(not LoadedStatBmps)then
LoadStatBmps;
if(not (GetColor(592,175)=2763390))then
begin
Mouse(577,178,10,10,true);
end;
if(stat='attack')or(stat='strength')or(stat='defense')or(stat='ranged')or(stat='prayer')or(stat='magic')or(stat='rc')then
col:=1
if(stat='hp')or(stat='agility')or(stat='herb')or(stat='thieve')or(stat='craft')or(stat='fletch')then
col:=2
if(stat='mine')or(stat='smith')or(stat='fish')or(stat='cook')or(stat='fire')or(stat='wc')then
col:=3
if(stat='attack')or(stat='hp')or(stat='mine')then
row:=1
if(stat='strength')or(stat='agility')or(stat='smith')then
row:=2
if(stat='defense')or(stat='herb')or(stat='fish')then
row:=3
if(stat='range')or(stat='thieve')or(stat='cook')then
row:=4
if(stat='prayer')or(stat='craft')or(stat='fire')then
row:=5
if(stat='magic')or(stat='fletch')or(stat='wc')then
row:=6
if(stat='rc')then
row:=7
if(bottom=0)then
begin
ox:=520+(col*64);
oy:=179+(row*31);
end;
if(bottom=1)then
begin
ox:=532+(col*64);
oy:=191+(row*31);
end;
ox2:=ox+9
oy2:=oy+9
if(FindBitmapMaskTolerance(s1,x,y,ox,oy,ox2,oy2,10,240))then
Result:=10
if(FindBitmapMaskTolerance(s2,x,y,ox,oy,ox2,oy2,10,240))then
Result:=20
if(FindBitmapMaskTolerance(s3,x,y,ox,oy,ox2,oy2,10,240))then
Result:=30
if(FindBitmapMaskTolerance(s4,x,y,ox,oy,ox2,oy2,10,240))then
Result:=40
if(FindBitmapMaskTolerance(s5,x,y,ox,oy,ox2,oy2,10,240))then
Result:=50
if(FindBitmapMaskTolerance(s6,x,y,ox,oy,ox2,oy2,10,240))then
Result:=60
if(FindBitmapMaskTolerance(s7,x,y,ox,oy,ox2,oy2,10,240))then
Result:=70
if(FindBitmapMaskTolerance(s8,x,y,ox,oy,ox2,oy2,10,240))then
Result:=80
if(FindBitmapMaskTolerance(s9,x,y,ox,oy,ox2,oy2,10,240))then
Result:=90
ox:=ox+6
ox2:=ox+9
if(FindBitmapMaskTolerance(s0,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+0
if(FindBitmapMaskTolerance(s1,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+1
if(FindBitmapMaskTolerance(s2,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+2
if(FindBitmapMaskTolerance(s3,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+3
if(FindBitmapMaskTolerance(s4,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+4
if(FindBitmapMaskTolerance(s5,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+5
if(FindBitmapMaskTolerance(s6,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+6
if(FindBitmapMaskTolerance(s7,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+7
if(FindBitmapMaskTolerance(s8,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+8
if(FindBitmapMaskTolerance(s9,x,y,ox,oy,ox2,oy2,10,240))then
Result:=Result+9
end;

Function GetHp:integer; {Created by Odie5533}
var Hp1,Hp2:integer;
begin
Hp1:=(GetStatFor('hp',0))
Hp2:=(GetStatFor('hp',1))
if(Hp1>0)and(Hp2>0)then
Result:=round((Hp1/Hp2)*100);
end;

Procedure StartScriptSlow; {Created by Odie5533}
begin
repeat
status(inttostr(round((ST-(GetSystemTime-5000))/1000)))
wait(100)
until(GetSystemTime-ST>4999)
end;

Procedure SetupOSi;
begin
setmousemode(false)
loadchars('')
ClearReport;
SetupOSiOSi;
flag := BitmapFromString(2, 2,
        'FF00005D3311C656045D3311');
ST:=GetSystemTime;
Writeln('Using OSi Version 3.31 - Created by Odie5533')
end;
